export default {
  data () {
    return {
      val: '',
      data1: []
    }
  },
  computed: {
    totalMarks () {
      let total = this.data1.length
      for (var i = 0; i < this.data1.length; i++) {
        if (this.data1[i].state === true) {
          total--
        }
      }
      return total
    }
  },
  methods: {
    onSubmit () {
      this.data1.push({ state: false, content: this.val })
      this.val = ''
    },
    deletePerson (index) {
      this.data1.splice(index, 1)
    },
    check (status, index) {
      status = true
    },
    shanchu () {
      let data2 = []
      data2 = this.data1
      let fun1 = function (d) {
        for (var i = 0; i < d.length; i++) {
          if (d[i].state === true) {
            d.splice(i, 1)
            fun1(d)
          }
        }
      }
      fun1(data2)
      this.data1 = data2
    }
  }
}